package org.gpp.proj1.camera.action;

import org.gpp.proj1.camera.CameraDirector;

import com.jme.scene.CameraNode;
import com.jme.scene.Node;

/**
 * 
 * @author Paolo Victor, paolovictor@gmail.com
 */
public class SetFocusAction implements CameraAction {
	
	/**
	 * Defines if the action is finished
	 */
	private boolean finished;

	private CameraDirector director;

	private Node target;
	
	public SetFocusAction( CameraDirector director, Node target ) {
		assert director != null : "Cannot create action with a null director";
		assert target != null : "Cannot create action with a null target";
		
		this.finished = false;
		
		this.director = director;
		this.target = target;
	}

	public void updateAction( float timePerFrame, CameraNode cameraNode ) {
		director.setFocusedObject( target );
		
		this.finished = true;
	}

	public boolean isFinished() {
		return finished;
	}

}
